home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
IOIterator.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
4KB
|
143 lines
/*
File: IOIterator.h
Contains: xxx put contents here xxx
Version: Technology: xxx put the technology version here xxx
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __IOITERATOR__
#define __IOITERATOR__
#ifndef __TYPES__
#include <Types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if FOR_SYSTEM8_PREEMPTIVE
/* typedefs*/
typedef UInt32 IteratorDescVersion;
/*
###########################################################
How to use the IteratorDescVersion
###########################################################
Each family will define a k<Family>CurrentIteratorDescVersion constant
in its *.i file. The client will check the returned IteratorDescVersion
value against this constant to make sure there's no version mismatch
problem.
Common data structure used by all I/O family iterators
*/
struct IODeviceRef {
UInt32 contents[4];
};
typedef struct IODeviceRef IODeviceRef;
/*
a family unique reference number for returned devices.
this is an opaque field, for now, use the name registry Ref value of the
device in question.
The IODeviceRef is unique within a family, NOT unique across the entire I/O name space
*/
struct IOCommonInfo {
IODeviceRef ref;
IteratorDescVersion versionNumber;
};
typedef struct IOCommonInfo IOCommonInfo;
/* IteratorDescVersion versionNumber: version number of the family specific IOIteratorData*/
#endif
/*
###########################################################
How to copy name registry ref --> IODeviceRef
###########################################################
{
IOCommonInfo DeviceData;
RegEntryRef *anotherReg, *whichDevice;
anotherReg = (RegEntryRef *)&DeviceData;
*anotherReg = *whichDevice;
}
###########################################################
How to define a family specific IOIteratorData structure
###########################################################
struct <FamilyName>IOIteratorData
{
IOCommonInfo IOCI;
// common data for all families
f1, // Individual family specific data
f2,
etc...
};
Example 1: (A possible implementation for the SCSI iterator)
struct SCSIIOIteratorData
{
IOCommonInfo IOCI;
// common data for all families
UInt32 BusID;
UInt32 TargetID;
UInt32 LUN;
};
###########################################################
How to define a family specific iterator function
###########################################################
OSStatus <FamilyName><IterationSpecification>GetDeviceData
( ItemCount requestItemCount,
FamilyIteratorData *(&<FamilyName>IOIteratorDataArray[requestItemCount]),
ItemCount *totalItemCountPtr );
For returning ALL devices that the family have access to
OSStatus <FamilyName><IterationSpecification>GetDeviceData
( UInt32 familySpecificParam,
ItemCount requestItemCount,
FamilyIteratorData *(&<FamilyName>IOIteratorDataArray[requestItemCount]),
ItemCount *totalItemCountPtr );
For returning a subset of devices, filtered by some family specific parameters
EXAMPLES:
OSStatus SCSIGetDeviceData
( ItemCount requestItemCount,
ItemCount *totalItemCountPtr,
SCSIIteratorData *(&SCSIIOIteratorDataArray[requestItemCount]));
To get all scsi devices
OSStatus SCSIBusGetDeviceData
( UInt32 BusID,
ItemCount requestItemCount,
ItemCount *totalItemCountPtr,
SCSIIteratorData *(&SCSIIOIteratorDataArray[requestItemCount]));
To get all scsi devices that matches the input BusID
*/
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import off
#endif
#ifdef __cplusplus
}
#endif
#endif /* __IOITERATOR__ */